﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

using EHTSaleManager.Code.Utility;

namespace EHTSaleManager.UIAdmin
{
    public partial class AdminUserComfirmDelete : System.Web.UI.Page
    {
        public String userName = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["UserName"] != null)
            {
                try
                {
                    userName = Request.QueryString["UserName"].ToString();
                }
                catch (Exception ex)
                {
                    userName = "";
                }
            }

            if (userName != "")
            {
                ViewState["ID"] = userName;
                this.ltrMessage.Text = "Er du sikker sletter brukeren : " + userName;
            }
        }

        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (ViewState["ID"] != null)
            {
                userName = ViewState["ID"].ToString();
                Membership.DeleteUser(userName);
            }

            Response.Redirect("AdminUsers.aspx");
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("AdminUsers.aspx");
        }
    }
}